package com.controller;

import com.pojo.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class CustomerController {

    @Autowired
    RestTemplate restTemplate;//基于Http远程调用

    private static final String REST_URL_PREFIX = "http://SPRINGCLOUD-PROVIDER";

    @GetMapping("/customer/get")
    public List<Dept> listDept(){
       return  restTemplate.getForObject(REST_URL_PREFIX+"/dept",List.class);
    }

}
